Skip to content

[BREAKING] Add OptableIdentifier.raw for pre-encoded identifiers - #98

Open
jrosendahl-opt wants to merge 2 commits into
masterfrom
feat/raw-identifier
Open

jrosendahl-opt wants to merge 2 commits into
masterfrom
feat/raw-identifier

Conversation

@jrosendahl-opt

Copy link
Copy Markdown
Contributor

Why

iOS apps can only send identifier types that have an OptableIdentifier case, so a new DCN identifier type needs an SDK release first. The Android SDK already accepts pre-encoded "type:value" strings through OptableIdentifier.Raw. Part of 2.0.0. Don't merge until 1.4.0, the last CocoaPods release, has shipped.

What Changed

  • Source: new OptableIdentifier.raw(String) taking a pre-encoded "type:value".
    • A known type is checked and normalized like its case. e and p values must already be SHA-256 digests, like .hem and .hashedPhoneNumber, so a plaintext Email or Phone number is dropped and never sent. Android's Raw sends these unchecked.
    • An unknown type is sent as given.
    • A value without both a type and a value is dropped.
    • prefix returns the type part.
  • Source: OptableIdentifier(extendedIdentifier:) is unchanged and still returns nil for unknown types; arbitrary types only come from an explicit .raw.
  • Source: targeting hids now skip identifiers that encode to an empty string, as ids already did. Before, a dropped .hem (and now .raw) went out as an empty hid=.
  • Docs: "Pre-encoded identifiers" section in the Swift usage guide.

How to Test

  • bundle exec fastlane tests passes (ran the suite on an iPhone 17 Pro simulator)
  • New tests: unknown type sent as given; known types encoded like their case; plaintext e:/p: rejected; malformed values dropped; prefix; targeting id/hid with raw and rejected values

Notes

🤖 Generated with Claude Code

.raw("type:value") lets apps send identifier types that have no case,
like the Android SDK's Raw. A known type is checked and normalized like
its case, so "e" and "p" values must already be SHA256 digests and a
plaintext Email or Phone number is never sent. An unknown type is sent
as given, and values missing a type or value are dropped.

Targeting hids now skip identifiers that encode to an empty string, as
ids already did, instead of sending an empty hid=.

Adding a case to the public OptableIdentifier enum breaks exhaustive
switches in apps, so this is for 2.0.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unknown type with a whitespace-only value, like "xyz:   ", was sent as
given. It's now dropped, matching #99, which drops typed identifiers that
are empty after normalization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant